package com.accounting.juanjuan.constant;

import com.accounting.juanjuan.exception.BizException;

/**
 * 执行力度
 *
 * @Author xxj
 * @Date 2024/1/31 9:00
 * @Version 1.0
 */
public enum EnforcementEnum {
    /**
     * 小力度
     */
    SMALL_FORCE("small", "低力度"),
    /**
     * 中力度
     */
    MEDIUM_STRENGTH("middle", "中力度"),
    /**
     * 大力度
     */
    INTENSIVE_EFFORTS("high", "高力度");

    /**
     * 值
     */
    private final String value;

    /**
     * 说明
     */
    private final String desc;

    EnforcementEnum(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public String getDesc() {
        return desc;
    }

    public String getValue() {
        return value;
    }

    public static void checkExist(String enforcement) {
        boolean isExist = false;
        for (EnforcementEnum enforcementEnum : EnforcementEnum.values()) {
            if (enforcementEnum.getValue().equals(enforcement)) {
                isExist = true;
                break;
            }
        }
        if (!isExist) {
            throw new BizException("执行力度不存在，无法执行！");
        }
    }
}
